Skip to content

feat: add Spector integration tests for Payload_Head and Payload_JsonMergePatch#4007

Closed
Copilot wants to merge 4 commits into
mainfrom
copilot/verify-implement-spector-tests
Closed

feat: add Spector integration tests for Payload_Head and Payload_JsonMergePatch#4007
Copilot wants to merge 4 commits into
mainfrom
copilot/verify-implement-spector-tests

Conversation

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Contributor

Adds Spector integration test coverage for two previously untested scenario groups: Payload_Head and Payload_JsonMergePatch.

Changes

  • test/commands/spector-list.js: Added payload/head and payload/json-merge-patch entries to the azureModularTsps array.
  • test/azureModularIntegration/generated/payload/head/: Added tspconfig.yaml, .gitignore, and generated src/index.d.ts for the HeadClient.
  • test/azureModularIntegration/generated/payload/json-merge-patch/: Added tspconfig.yaml, .gitignore, and generated src/index.d.ts for the JsonMergePatchClient.
  • test/azureModularIntegration/payloadHead.spec.ts: New spec covering contentTypeHeaderInResponse (HEAD request; mock server validates 200).
  • test/azureModularIntegration/payloadJsonMergePatch.spec.ts: New spec covering createResource (PUT with full body), updateResource, and updateOptionalResource (PATCH with JSON merge-patch null field-removal semantics).

Known emitter limitations

  • HEAD headers not assertable: HeadClient.contentTypeHeaderInResponse() returns Promise<void>; response headers (Content-Type, x-ms-meta) are not surfaced by the emitter. Server validation on 200 is the effective assertion.
  • Nullable merge-patch fields: The generated ResourcePatch type uses ? (optional) fields rather than T | null, so as any casts are required to pass null values for field-removal. The serializer preserves null at runtime correctly.

Copilot AI changed the title [WIP] Verify and implement spector integration tests for scenario groups feat: add Spector integration tests for Payload_Head and Payload_JsonMergePatch May 29, 2026
Copilot AI requested a review from v-jiaodi May 29, 2026 07:40
Comment on lines +18 to +21
// The generated client returns void for HEAD operations; response headers
// (Content-Type and x-ms-meta) are validated by the mock server (returns 200
// only when the request is correct). No header assertions can be made here
// because the emitter does not expose response headers in the return type.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot create issue for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the ability to create GitHub issues directly. Please create an issue with the following details:

Title: [Emitter] HEAD operations should surface response headers in the return type

Description:
The TypeSpec emitter generates Promise<void> for HEAD operations (e.g. HeadClient.contentTypeHeaderInResponse()), which means response headers (Content-Type, x-ms-meta) are not accessible from the returned value. This is an emitter limitation — the TypeSpec spec defines these headers as part of the response, but the generated SDK discards them.

Scenario: Payload_Head / contentTypeHeaderInResponse (payload/head/content-type-header-in-response)

Expected behavior: The generated method should return an object containing the response headers, e.g.:

{ contentType?: string; metadata?: string }

Actual behavior: Returns Promise<void>, making header assertions impossible in integration tests.

Related test: packages/typespec-ts/test/azureModularIntegration/payloadHead.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Copilot] Verify and implement spector tests for 14 scenario groups

3 participants